//
//  CoachVideo.m
//  CoolTennisBall
//
//  Created by CA on 16/6/17.
//  Copyright © 2016年 CoolLang. All rights reserved.
//

#import "CoachVideo.h"
#import "NSString+Extension.h"

@implementation CoachVideo

//+ (NSDictionary *)modelCustomPropertyMapper {
//    return @{
//             @"videoId": @"ID",
//             @"name": @"Name",
//             @"url": @"Url",
//             @"preview": @"PicUrl",
//             @"duration": @"Time",
//             @"size": @"Size",
//             @"viewTimes": @"ViewTimes",
//             @"starName": @"StarName",
//             @"creatTime": @"CreateTime",
//             };
//}

+ (NSArray <CoachVideo *> *)creatModelArrayWith:(NSArray *)sourceArray{
    NSMutableArray *arry = [NSMutableArray array];
    for (NSDictionary *dic in sourceArray) {
        [arry addObject:[self creatModelWith:dic]];
    }
    return arry.mutableCopy;
}

+ (CoachVideo *)creatModelWith:(NSDictionary *)sourceDic{
    CoachVideo *model = [self new];
    model.videoId = [NSString checkIfNullWithString:sourceDic[@"ID"]];
    model.name = [NSString checkIfNullWithString:sourceDic[@"Title"]];
    model.url = [NSString checkIfNullWithString:sourceDic[@"Url"]];
    model.preview = [NSString checkIfNullWithString:sourceDic[@"ThumbUrl"]];
    model.state = [[NSString checkIfNullWithString:sourceDic[@"State"]] integerValue];
    model.type = [[NSString checkIfNullWithString:sourceDic[@"Type"]] integerValue];
    model.sortOrder = [[NSString checkIfNullWithString:sourceDic[@"SortOrder"]] integerValue];
    model.content = [NSString checkIfNullWithString:sourceDic[@"Content"]];
    model.duration = [NSString checkIfNullWithString:sourceDic[@"Length"]];
    return model;
}

+ (instancetype)creatTestCoachVideoWithStarName:(NSString *)starName {
    CoachVideo *testVideo = [CoachVideo new];
    testVideo.name = @"Forehand clear";
    testVideo.preview = @"notice-4";
    testVideo.starName = starName;
    return testVideo;
}

@end
